package com.tencent.FanXing;

public class GenericDemo1 {
	public static void main(String[] args) {
		// 创建一个泛型类对象
		GenClass<String> gen1 = new GenClass<String>("达源");
		System.out.println(gen1.getData());
		GenClass<Integer> gen2 = new GenClass<Integer>(24);
		System.out.println(gen2.getData());
//		GenClass<GenClass<Student>> gen3 = new GenClass<GenClass<Student>>(2);
	}
}

// 创建一个泛型类
 class GenClass<T> {
	private T data;

	public GenClass(T data) {
		this.data = data;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
}

class genClass2<T1, T2> {
	private T1 data1;
	private T2 data2;

	public genClass2(T1 data1, T2 data2) {
		this.data1 = data1;
		this.data2 = data2;
	}

	public T1 getData1() {
		return data1;
	}

	public T2 getData2() {
		return data2;
	}
}

class Student{
	private int data1;
	private int data2;

	public Student(int data1, int data2) {
		this.data1 = data1;
		this.data2 = data2;
	}

	public int getData1() {
		return data1;
	}

	public int getData2() {
		return data2;
	}
}
